<template>
  <div class="collapse_parent">
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: "collapseParentCom",
  components: {},
  provide() {
    //把该实例作为参数传递下去，子代可以直接使用 [inject]
    return {
      collapseParent: this //实例名称为collapseParent
    };
  },
  props: {
    firstOpen: {
      type: Boolean,
      default: true
    }, //第一个collapse是否展开
    allOpen: {
      type: Boolean,
      default: false
    } // 是否默认全部展开
  },
  data() {
    return {};
  },
  watch: {},
  computed: {},
  methods: {},
  created() {},
  mounted() {
    this.$nextTick(function() {
      let childs = this.$children;
      childs[childs.length - 1].bottomBorder = false;
      if (this.firstOpen) {
        childs[0].isCollapseFold = false;
      }
      if (this.allOpen) {
        childs.map(item => {
          item.isCollapseFold = false;
        });
      }
    });
  },
  destroyed() {}
};
</script>
<style lang="scss" scoped>
.collapse_parent {
  width: 100%;
}
</style>